import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { FormBuilder, Validators } from '@angular/forms';
import { NzMessageService, NzModalService } from 'ng-zorro-antd';
import * as FileSaver from 'file-saver';
import * as XLSX from 'xlsx';
import { ApiService } from 'src/app/core/api';
/**
 * 已修复漏洞
 */

@Component({
    templateUrl: './security-equipment.html',
    styleUrls:['security-equipment.scss'],
})
export class SecurityEquipmentComponent implements OnInit {
    dataList = [];
    count= {};
    pages={
        pageNo:1,
        pageSize:10
    };
    ngOnInit() {
        this.loadList();
    }
    constructor(
        private router: Router,
        private fb: FormBuilder,
        private apiService: ApiService,
        private nzMessageService: NzMessageService,
        private modal: NzModalService
    ) { }
    loadList() {
        this.apiService.post('设备视图', this.pages).then((res: any) => {
            this.dataList = res.data.permissions;
        })
    }
    checkedAll(item){
        if(item.checked){
            item.list.forEach(element => {
                element.checked = true;
            });
        }else{
            item.list.forEach(element => {
                element.checked = false;
            });
        }
    }
}
